/*
 * #%L
 * SwiftUIDataAccessLayer
 * $Id:$
 * $HeadURL:$
 * %%
 * Copyright (C) 2011 - 2012 Linkwithweb
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public 
 * License along with this program.  If not, see
 * <http://www.gnu.org/licenses/gpl-3.0.html>.
 * #L%
 */
/**
 * 
 */
package com.linkwithweb.products.swiftui.rowmapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.linkwithweb.products.swiftui.dataobject.FrameworkLOV;
import com.linkwithweb.products.swiftui.dataobject.FrameworkUser;

/**
 * DROP TABLE IF EXISTS `automata`.`frm_users`;
 * CREATE TABLE `automata`.`frm_users` (
 * `UNIQUE_KEY` int(10) unsigned NOT NULL AUTO_INCREMENT,
 * `USER_ID` varchar(45) NOT NULL,
 * `USER_FIRST_NAME` varchar(45) NOT NULL,
 * `USER_LAST_NAME` varchar(45) NOT NULL,
 * `USER_MIDDLE_NAME` varchar(45) NOT NULL,
 * `USER_PASSWORD` varchar(45) NOT NULL,
 * `USER_BIRTHDATE` datetime NOT NULL,
 * `USER_SEX` varchar(45) NOT NULL,
 * `DEFAULT_DATE_FORMAT` varchar(45) DEFAULT NULL,
 * `DEFAULT_NUMBER_FORMAT` varchar(45) DEFAULT NULL,
 * `USER_EMAIL` varchar(45) NOT NULL,
 * `USER_PHONE` bigint(20) unsigned DEFAULT NULL,
 * `IDENTIFIER` varchar(45) NOT NULL,
 * `IDENTIFIER_ROLE` varchar(45) NOT NULL,
 * `CREATED_BY` int(10) unsigned NOT NULL,
 * `CREATED_DATE` datetime NOT NULL,
 * `MODIFIED_BY` int(10) unsigned NOT NULL,
 * `MODIFIED_DATE` datetime NOT NULL,
 * PRIMARY KEY (`UNIQUE_KEY`)
 * ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
 * 
 * @author ashwin kumar
 * 
 */
public class FrameworkUserRowMapper extends AbstractRowMapper {

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.springframework.jdbc.core.RowMapper#mapRow(java.sql.ResultSet,
	 * int)
	 */
	public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
		FrameworkUser user = new FrameworkUser();
		user.setDefaultDateFormat(rs.getString("DEFAULT_DATE_FORMAT"));
		user.setDefaultNumberFormat(rs.getString("DEFAULT_NUMBER_FORMAT"));
		user.setUniqueKey(rs.getLong("UNIQUE_KEY"));
		user.setUserBirthDate(rs.getDate("USER_BIRTHDATE"));
		user.setUserEmail(rs.getString("USER_EMAIL"));
		user.setUserFirstName(rs.getString("USER_FIRST_NAME"));
		user.setUserId(rs.getString("USER_ID"));
		user.setUserLastName(rs.getString("USER_LAST_NAME"));
		user.setUserMiddleName(rs.getString("USER_MIDDLE_NAME"));
		user.setUserPassword(rs.getString("USER_PASSWORD"));
		user.setUserPhone(rs.getInt("USER_PHONE"));
		user.setUserSex(rs.getString("USER_SEX"));
		user.setUserLatitude(rs.getDouble("USER_LATITUDE"));
		user.setUserLongitude(rs.getDouble("USER_LONGITUDE"));
		return mapDefaultColumns(user, rs);
	}

}
